﻿using System;
using ltModel;

public partial class ltMan_messages_messageReply : AdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string id = Request.QueryString["id"];
            if (Str.IsInt(id))
            {
                ltModel.Model.message mbo = new ltModel.BLL.message().GetModel(Int32.Parse(id));
                lbl_title.Text = Str.Getrep(mbo.title);
                //lbl_addr.Text = Str.Getrep(mbo.addr);
                lbl_username.Text = Str.Getrep(mbo.username);
                lbl_tel.Text = Str.Getrep(mbo.tel);
                lbl_email.Text = Str.Getrep(mbo.email);
                lbl_time.Text = Str.Getrep(mbo.addtime);
                lbl_content.Text = Str.Getrep(mbo.content).Replace("\r", "<br>");
                txt_rel.Text = Str.Getrep(mbo.rel);
                txt_relren.Text = Str.Getrep(mbo.relren);
                txt_reltime.DbSelectedDate = string.IsNullOrEmpty(mbo.reltime) ? DateTime.Now.ToString() : mbo.reltime;
            }
        }
    }
    protected void RadSave_Click(object sender, EventArgs e)
    {
        string id = Request.QueryString["id"];
        ltModel.BLL.message msg = new ltModel.BLL.message();
        ltModel.Model.message mbo = msg.GetModel(Int32.Parse(id));
        mbo.rel = txt_rel.Text.Trim().Replace("'", "''");
        mbo.relren = txt_relren.Text.Trim().Replace("'", "''");
        mbo.reltime = txt_reltime.SelectedDate.ToString();
        mbo.relip = Request.UserHostAddress.ToString();
        msg.Update(mbo);
        infoPanel.AddSuccessInfo("操作成功！");
        AddScriptM("setTimeout(parent.reloadData, 300);");
        OperateLog.AddSuccessLog(CurrentUser.user_id, Request.UserHostAddress, "在线留言-回复>" + mbo.title);
    }
}